package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.ResearchAward;
import com.ruoyi.personnel.mapper.ResearchAwardMapper;
import com.ruoyi.personnel.service.IResearchAwardService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教学奖励Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-03
 */
@Service
public class ResearchAwardServiceImpl extends ServiceImpl<ResearchAwardMapper, ResearchAward> implements IResearchAwardService {

    @Override
    public List<ResearchAward> queryList(ResearchAward researchAward) {
        LambdaQueryWrapper<ResearchAward> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(researchAward.getName())){
            lqw.like(ResearchAward::getName ,researchAward.getName());
        }
        if (StringUtils.isNotBlank(researchAward.getJobNumber())){
            lqw.eq(ResearchAward::getJobNumber ,researchAward.getJobNumber());
        }
        if (StringUtils.isNotBlank(researchAward.getPersonnelId())){
            lqw.eq(ResearchAward::getPersonnelId ,researchAward.getPersonnelId());
        }
        if (StringUtils.isNotBlank(researchAward.getOfficeName())){
            lqw.like(ResearchAward::getOfficeName ,researchAward.getOfficeName());
        }
        if (researchAward.getOfficeId() != null){
            lqw.eq(ResearchAward::getOfficeId ,researchAward.getOfficeId());
        }
        if (StringUtils.isNotBlank(researchAward.getAwardName())){
            lqw.like(ResearchAward::getAwardName ,researchAward.getAwardName());
        }
        if (StringUtils.isNotBlank(researchAward.getAwardLevel())){
            lqw.eq(ResearchAward::getAwardLevel ,researchAward.getAwardLevel());
        }
        if (StringUtils.isNotBlank(researchAward.getAwardDept())){
            lqw.eq(ResearchAward::getAwardDept ,researchAward.getAwardDept());
        }
        if (StringUtils.isNotBlank(researchAward.getAwardDate())){
            lqw.eq(ResearchAward::getAwardDate ,researchAward.getAwardDate());
        }
        if (StringUtils.isNotBlank(researchAward.getRanking())){
            lqw.eq(ResearchAward::getRanking ,researchAward.getRanking());
        }
        if (StringUtils.isNotBlank(researchAward.getEnclosure())){
            lqw.eq(ResearchAward::getEnclosure ,researchAward.getEnclosure());
        }
        if (StringUtils.isNotBlank(researchAward.getEnclosureName())){
            lqw.like(ResearchAward::getEnclosureName ,researchAward.getEnclosureName());
        }
        if (StringUtils.isNotBlank(researchAward.getStatus())){
            lqw.eq(ResearchAward::getStatus ,researchAward.getStatus());
        }
        return this.list(lqw);
    }
}
